echarts+流程图

前言:

         echarts+流程图

效果图:

实现源码:

var title = [
    // 第零层
    {
        label: '0',
        warn: 5,
        error: 8,
        value: 2
    },
    // 第一层
    {
        label: '1-0',
        warn: 5,
        error: 8,
        value: 5
    },
    {
        label: '1-1',
        warn: 5,
        error: 8,
        value: 7
    },
    {
        label: '1-2',
        warn: 5,
        error: 8,
        value: 7
    },
    {
        label: '1-3',
        warn: 5,
        error: 8,
        value: 7
    },
    // 第二层
    {
        label: '2-0',
        warn: 5,
        error: 8,
        value: 2
    },
    {
        label: '2-1',
        warn: 5,
        error: 8,
        value: 2
    },
    {
        label: '2-2',
        warn: 5,
        error: 8,
        value: 2
    },
    {
        label: '2-3',
        warn: 5,
        error: 8,
        value: 2
    },
    {
        label: '2-4',
        warn: 5,
        error: 8,
        value: 2
    },
    // 第三层
    {
        label: '3-0',
        warn: 5,
        error: 8,
        value: 2
    },
    {
        label: '3-1',
        warn: 5,
        error: 8,
        value: 2
    },
    {
        label: '3-2',
        warn: 5,
        error: 8,
        value: 2
    },
];
var colorMap = {
    normal: '#18a849',
    warn: '#FFC125',
    error: '#FF0000',
};

colorFunction = function(obj) {
    if (obj.value < obj.warn) {
        return colorMap.normal;
    } else if (obj.warn <= obj.value && obj.value < obj.error) {
        return colorMap.warn;
    } else if (obj.error <= obj.value) {
        return colorMap.error;
    }
};
//具体的绘制流程图的方法
option = {
    tooltip: {
        trigger: 'item',
        formatter: function(para) {
            if (para.name != 'x' || para.name != 'y') {
                return para.name;
            } else {
                //其他的都正式显示,自己是什么就显示什么。
                return '';
            }
        }
    },
    animationDurationUpdate: 1500,
    animationEasingUpdate: 'quinticInOut',
    textStyle: {
        color: '#000'
    },
    series: [{
        type: 'graph',
        tooltip: {
            backgroundColor: 'skyblue',
            //formatter: "{b} <br/>{a} : {c} h "
        },
        layout: 'none',
        symbolSize: 10,
        roam: false,
        label: {
            normal: {
                show: true,
                position: 'inside',
                //offset: [0,-60],//居上 20
                textStyle: {
                    fontSize: 12,
                    color: '#fff',
                    fontWeight: 'BOLD',
                },
            }
        },
        edgeSymbol: ['circle', 'arrow'],
        edgeSymbolSize: [4, 10],
        edgeLabel: {
            normal: {
                textStyle: {
                    fontSize: 18
                }
            }
        },
        //注意,所有节点的位置都是根据自己设置的x, y坐标来设置的
        data: [
            // 零层
            {
                name: title[0].label,
                x: 300,
                y: 0,
                value: title[0],
                symbolSize: 50,
                itemStyle: {
                    normal: {
                        color: colorFunction(title[0]),
                    }
                }
            },
            // 一层
            {
                name: title[1].label,
                x: 0,
                y: 200,
                value: title[1],
                symbolSize: 50,
                itemStyle: {
                    normal: {
                        color: colorFunction(title[1]),
                    }
                }
            },
            {
                name: title[2].label,
                x: 150,
                y: 200,
                value: title[2],
                symbolSize: 50,
                itemStyle: {
                    normal: {
                        color: colorFunction(title[2]),
                    }
                }
            },
            {
                name: title[3].label,
                x: 350,
                y: 200,
                value: title[3],
                symbolSize: 50,
                itemStyle: {
                    normal: {
                        color: colorFunction(title[3]),
                    }
                }
            },
            {
                name: title[4].label,
                x: 600,
                y: 200,
                value: title[4],
                symbolSize: 50,
                itemStyle: {
                    normal: {
                        color: colorFunction(title[4]),
                    }
                }
            },
            // 二层
            {
                name: title[5].label,
                x: 0,
                y: 400,
                value: title[5],
                symbolSize: 50,
                itemStyle: {
                    normal: {
                        color: colorFunction(title[5]),
                    }
                }
            },
            {
                name: title[6].label,
                x: 150,
                y: 400,
                value: title[6],
                symbolSize: 50,
                itemStyle: {
                    normal: {
                        color: colorFunction(title[6]),
                    }
                }
            },
            {
                name: title[7].label,
                x: 300,
                y: 400,
                value: title[7],
                symbolSize: 50,
                itemStyle: {
                    normal: {
                        color: colorFunction(title[7]),
                    }
                }
            },
            {
                name: title[8].label,
                x: 450,
                y: 400,
                value: title[8],
                symbolSize: 50,
                itemStyle: {
                    normal: {
                        color: colorFunction(title[8]),
                    }
                }
            },
            {
                name: title[9].label,
                x: 600,
                y: 400,
                value: title[9],
                symbolSize: 50,
                itemStyle: {
                    normal: {
                        color: colorFunction(title[9]),
                    }
                }
            },
            // 三层
            {
                name: title[10].label,
                x: 0,
                y: 600,
                value: title[10],
                symbolSize: 50,
                itemStyle: {
                    normal: {
                        color: colorFunction(title[10]),
                    }
                }
            },
            {
                name: title[11].label,
                x: 150,
                y: 600,
                value: title[11],
                symbolSize: 50,
                itemStyle: {
                    normal: {
                        color: colorFunction(title[11]),
                    }
                }
            },
            {
                name: title[12].label,
                x: 450,
                y: 600,
                value: title[12],
                symbolSize: 50,
                itemStyle: {
                    normal: {
                        color: colorFunction(title[12]),
                    }
                }
            },

            // 一层
            {
                name: '1',
                x: 300,
                y: 100,
                symbolSize: 0,
            },
            {
                name: '2',
                x: 150,
                y: 100,
                symbolSize: 0,
            },
            {
                name: '3',
                x: 0,
                y: 100,
                symbolSize: 0,
            },
            {
                name: '4',
                x: 350,
                y: 100,
                symbolSize: 0,
            },
            {
                name: '5',
                x: 600,
                y: 100,
                symbolSize: 0,
            },
            // 二层
            {
                name: '21',
                x: 0,
                y: 300,
                symbolSize: 0,
            },
            {
                name: '22',
                x: 150,
                y: 300,
                symbolSize: 0,
            },
            {
                name: '23',
                x: 300,
                y: 300,
                symbolSize: 0,
            },
            {
                name: '24',
                x: 350,
                y: 300,
                symbolSize: 0,
            },
            {
                name: '25',
                x: 450,
                y: 300,
                symbolSize: 0,
            },
            {
                name: '26',
                x: 600,
                y: 300,
                symbolSize: 0,
            },
            // 三层
            {
                name: '31',
                x: 0,
                y: 500,
                symbolSize: 0,
            },
            {
                name: '32',
                x: 150,
                y: 500,
                symbolSize: 0,
            },
            {
                name: '33',
                x: 300,
                y: 500,
                symbolSize: 0,
            },
            {
                name: '34',
                x: 450,
                y: 500,
                symbolSize: 0,
            },
        ],
        // links: [],
        //这是点与点之间的连接关系
        links: [
            // 零层
            {
                source: title[0].label,
                target: '1',
            },
            // 一层
            {
                source: '3',
                target: title[1].label,
            },
            {
                source: '2',
                target: title[2].label,
            },
            {
                source: '4',
                target: title[3].label,
            },
            {
                source: '5',
                target: title[4].label,
            },
            // 二层
            {
                source: title[3].label,
                target: '24',
            },
            {
                source: '21',
                target: title[5].label,
            },
            {
                source: '22',
                target: title[6].label,
            },
            {
                source: '23',
                target: title[7].label,
            },
            {
                source: '25',
                target: title[8].label,
            },
            {
                source: '26',
                target: title[9].label,
            },
            // 三层
            {
                source: title[7].label,
                target: '33',
            },
            {
                source: '31',
                target: title[10].label,
            },
            {
                source: '32',
                target: title[11].label,
            },
            {
                source: '34',
                target: title[12].label,
            },

            // 一层
            {
                source: '1',
                target: '2',
                symbol: 'none',
            },
            {
                source: '2',
                target: '3',
                symbol: 'none',
            },
            {
                source: '1',
                target: '4',
                symbol: 'none',
            },
            {
                source: '4',
                target: '5',
                symbol: 'none',
            },
            // 二层
            {
                source: '21',
                target: '22',
                symbol: 'none',
            },
            {
                source: '22',
                target: '23',
                symbol: 'none',
            },
            {
                source: '23',
                target: '24',
                symbol: 'none',
            },
            {
                source: '24',
                target: '25',
                symbol: 'none',
            },
            {
                source: '25',
                target: '26',
                symbol: 'none',
            },
            // 三层
            {
                source: '31',
                target: '32',
                symbol: 'none',
            },
            {
                source: '32',
                target: '33',
                symbol: 'none',
            },
            {
                source: '33',
                target: '34',
                symbol: 'none',
            },
        ],
        //线条的颜色
        lineStyle: {
            normal: {
                opacity: 0.9,
                color: '#53B5EA',
                type: 'dashed',
                width: 1
            }
        }
    }]
};

更多入口

  • 7
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ECharts是一个强大的数据可视化库,提供了丰富的图表和图形类型,可用于在网页上展示各种数据。而ECharts的ASP.NET源码指的是使用ASP.NET开发框架编写的ECharts的相关代码和应用。 ECharts的ASP.NET源码通常包含两部分:前端代码和后端代码。前端代码主要使用JavaScript和HTML,用于创建和配置图表实例,处理用户交互等。后端代码则使用C#或其他ASP.NET支持的语言,用于获取数据并返回给前端,实现数据的动态更新和交互。 在ECharts的ASP.NET源码中,前端代码通常需要引入ECharts的JavaScript库,并使用相关的API来创建各种图表实例。通过配置不同的选项,可以设置图表的样式、数据、标题、坐标轴等属性,从而实现不同类型的图表展示。 而后端代码则需要处理数据的获取和处理。可以通过数据库查询、接口调用等方式获取数据,并利用ASP.NET的数据处理技术进行数据的处理和封装。最后,将经处理后的数据返回给前端,在网页上实现动态展示和刷新。 ECharts的ASP.NET源码的开发过程需要熟悉ECharts的相关API和ASP.NET的开发技术。通过合理的代码组织和模块化设计,可以提高代码的可维护性和扩展性。在实际开发中,还可以结合其他的前端或后端框架,如Bootstrap、jQuery、ASP.NET MVC等,来简化开发流程和提高用户体验。 总而言之,ECharts的ASP.NET源码是使用ASP.NET开发框架编写的ECharts相关代码和应用。通过前端和后端的配合,实现了数据的可视化展示和动态更新。这可以帮助开发者根据具体需求快速搭建互动的、直观的数据展示页面。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值